// Widgets/User/UserHead/UserHead.js
//获取应用实例
const app = getApp();
const assetsAddress = app.globalData.global.assetsIp + '/' + app.globalData.global.assetsName;
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    user: {
      type: Object,
      value: {}
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    assetsAddress: assetsAddress,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 页面跳转
    goNext(e){
      let type = e.target.dataset.type||e.currentTarget.dataset.type;
      let url = e.target.dataset.name||e.currentTarget.dataset.name;
      let item = e.target.dataset.item||e.currentTarget.dataset.item;
      // console.log(JSON.stringify(item))
      // return
      if(item){
        if(type == 1){
          wx.switchTab({
            url: `${url}`,
          })
        }else{
          wx.navigateTo({
            url: `${url}?item=${JSON.stringify(item)}`,
          })
        }
      }else{
        if(type == 1){
          wx.switchTab({
            url: `${url}`,
          })
        }else{
          wx.navigateTo({
            url: `${url}`,
          })
        }
      }
    },
  }
})